<template>
	<div>
		<!-- :visible.sync="$store.state.bbsInfoflag" -->
		<el-dialog :close-on-click-modal="flag" :show-close="flag" title="员工信息" :visible.sync="$store.state.userInfoflag"
		 width="30%" center>
			<span>
				<!-- ////////////////////// -->
				<el-form ref="form" label-width="80px">
					<el-form-item label="用户id">
						<el-input v-model="userdetails.userbaseinfo.uid" maxlength=15 disabled></el-input>
					</el-form-item>
					<el-form-item label="用户姓名">
						<el-input v-model="userdetails.userbaseinfo.uname" maxlength=15 disabled></el-input>
					</el-form-item>
					<el-form-item label="用户密码">
						<el-input v-model="userdetails.userbaseinfo.upwd" maxlength=15 disabled></el-input>
					</el-form-item>
					<el-form-item label="用户邮箱">
						<el-input v-model="userdetails.userbaseinfo.uemail" maxlength=15 disabled></el-input>
					</el-form-item>
					<el-form-item label="用户电话">
						<el-input v-model="userdetails.userbaseinfo.uphone" maxlength=15 disabled></el-input>
					</el-form-item>
					<el-form-item label="用户状态">
						<el-radio v-model="userdetails.userbaseinfo.ustate" :label="lab0">正常</el-radio>
						<el-radio v-model="userdetails.userbaseinfo.ustate" :label="lab1">拉黑</el-radio>
					</el-form-item>
					<el-form-item label="会员等级">
						<el-input v-model="userdetails.userbaseinfo.umebnum" maxlength=15  @keyup.native="trim()"></el-input>
					</el-form-item>
				</el-form>
				<!-- ////////////////////// -->
			</span>
			<span slot="footer" class="dialog-footer">
				<!-- 	<el-button type="danger" @click="Staffflag1(false)">删除</el-button> -->
				<el-button @click="cancel()">取 消</el-button>
					<el-button type="primary" @click="Userflag(false)">保存</el-button>
			</span>
		</el-dialog>
	</div>
</template>

<script>
	import {
		request
	} from "network/request.js"
	export default {
		props: {
			userdetails: {
				"bbsinfoList": [{
					"bbsid": 0,
					"bbsremark": "string",
					"bbsstage": "string",
					"bbstime": "2019-10-10T11:19:11.019Z",
					"bbstype": "string",
					"uid": 0
				}],
				"longorderList": [{
					"longcreatetime": "2019-10-10T11:19:11.019Z",
					"longdetail": "string",
					"longedtime": "2019-10-10T11:19:11.019Z",
					"longid": 0,
					"longprice": 0,
					"longremark": "string",
					"longremark2": "string",
					"longretime": "2019-10-10T11:19:11.019Z",
					"longstate": "string",
					"mealid": 0,
					"u2id": 0,
					"uid": 0
				}],
				"majororderList": [{
					"major0remark2": "string",
					"majorcreatetime": "2019-10-10T11:19:11.019Z",
					"majordetail": "string",
					"majorid": 0,
					"majormealid": 0,
					"majorprice": 0,
					"majorremark": "string",
					"majorstate": "string",
					"u2id": 0,
					"uid": 0
				}],
				"shortorderList": [{
					"longremark": "string",
					"longremark2": "string",
					"longstate": "string",
					"mealid": 0,
					"shortcreatetime": "2019-10-10T11:19:11.019Z",
					"shortdetail": "string",
					"shortid": 0,
					"shortprice": 0,
					"u2id": 0,
					"uid": 0
				}],
				"userbaseinfo": {
					"uemail": "string",
					"uid": 0,
					"umeb": "string",
					"umebnum": 0,
					"uname": "string",
					"uphone": "string",
					"upwd": "string",
					"uremark": "string",
					"uremark2": "string",
					"uremark3": "string",
					"ustate": "0"
				},
				"userinfo2List": [{
					"u2addressinfo": "string",
					"u2baseaddress": "string",
					"u2id": 0,
					"u2name": "string",
					"u2phone": "string",
					"u2remark": "string",
					"u2state": "string",
					"u2type": "string",
					"uid": 0
				}]
			}


		},
		data() {
			return {
				lab0: '0',
				lab1: '1',
				lab2: '2',
				flag: false,
				flag2: true,
				bbstate2: "1",
				emptype: ""
			};
		},
		methods: {
			Userflag(flag) {
				request({
					url: '/User/UserInfo',
					method: 'patch',
					data: {
						"uemail": this.userdetails.userbaseinfo.uemail,
						"uid": this.userdetails.userbaseinfo.uid,
						"umeb": this.userdetails.userbaseinfo.umeb,
						"umebnum": this.userdetails.userbaseinfo.umebnum,
						"uname": this.userdetails.userbaseinfo.uname,
						"uphone": this.userdetails.userbaseinfo.uphone,
						"upwd": this.userdetails.userbaseinfo.upwd,
						"uremark": this.userdetails.userbaseinfo.uremark,
						"uremark2": this.userdetails.userbaseinfo.uremark2,
						"uremark3": this.userdetails.userbaseinfo.uremark3,
						"ustate": this.userdetails.userbaseinfo.ustate
					}
				}).then(res => {
					this.$store.commit("updateUserInfoflag", false)
					this.$router.push("blank_emt")
				})

			},
		trim() {
				this.userdetails.userbaseinfo.umebnum = this.userdetails.userbaseinfo.umebnum.replace(/[^0-9\.]/g, '')
				// console.log(this.form.name)
			},
			cancel() {
				console.log(this.userdetails.userbaseinfo)
				this.$store.commit("updateUserInfoflag", false)
				// this.$store.commit("updateMealid", 0)
				this.$router.push("blank_emt")
			},
			onSubmit() {
				console.log('submit!');
			}
		}
	};
</script>

<style scoped>
	.el-select {
		width: 130px;
	}

	.input-with-select .el-input-group__prepend {
		background-color: #fff;
	}
</style>
